1. Field of the Invention
The present invention generally relates to the art of object oriented programming in the field of computer science and, more particularly, to a technique for high performance context switching which facilitates the development of programs using an application builder by easily switching methods when there is a change in the mode of an application, for example a change between run and build modes.
2. Description of the Prior Art
The use of object oriented programming (OOP) techniques has become increasingly popular in recent years. OOP is the preferred environment for building user-friendly, intelligent computer software. Key elements of OOP are data encapsulation, inheritance and polymorphism. Object classes are used for the encapsulation of information and behavior. The object classes can be used to create other similar objects. Then, these object classes can be customized for a particular application. Object data is stored in attributes and object behaviors are called methods.
The advantages of OOP include the ability to share and reuse code due to the use of specialization and encapsulation. This, in turn, increases the productivity of the programmers. In addition, object oriented techniques are particularly useful for generating graphical user interfaces (GUI) which are more intuitive. These interfaces use icons, including folders, documents, printers, and trash cans, to represent objects and use a windowing environment utilizing mouse cursors and menus.
Further information on the subject of object oriented programming may be had by reference to Object Oriented Design with Applications by Grady Booch, The Benjamin/Cummings Publishing Co., Inc., Redwood City, Calif. (1991), and An Introduction to Object-Oriented Programming by Timothy Budd, Addison-Wesley Publishing Co. (1991).
The simplicity of OOP has created a new environment which is available for programmers called visual programming. In this area, programming is accomplished by dragging and dropping desired objects. Lines are drawn from source objects to target objects to signify a connection between the objects. A connection is a method invocation which is usually triggered by a static event, for example a press of a button or an abstract event, such as the change of an object's color attribute value.
The design of an object oriented visual programming environment requires the definition of methods which are supported by an object. However, the behavior of an object may vary depending on whether it is invoked during the building of the application and within a completed application. Hereinafter, the behavior within a completed application is referred to as "run mode" behavior, and the behavior when the application is being built is referred to as "build mode" behavior. Although, the following examples use build and run mode, it is possible for there to be other modes. For example, in building an application builder using an application builder, there would be build and run modes for both the builder and the application.
Two examples of visual objects are a check box, which is a box on the screen that may or may not have a check in it, and a spin button, which has a value region and an up arrow and a down arrow. In run mode, the check box allows the user to place the mouse cursor within the box and press a mouse button (this operation is called a click) to change its state from checked to unchecked or from unchecked to checked. The check box object may have a method, "ToggleState", that is called whenever the user clicks on the check box.
The value region of the spin button contains one of a list of elements. In run mode, Clicking the cursor on the down arrow changes the value region to the next element in the list. Clicking the cursor on the up arrow changes the value to the previous element in the list. Therefore, a spin button may have methods called "SpinUp" and "SpinDown" that are invoked respectively when the user clicks on the up or down arrow in the spin button.
As illustrated in the above examples, during the build mode, the method is invoked to allow the user to accomplish a desired action. However, in build mode, the programmer needs information about the attributes of the object, for example the location, size, shape, and color of the object. Therefore, during build mode, the methods which need to be invoked are Resize, Move, SetColor, and the like. It is therefore desired that the behavior of the object can vary with the mode of the application.
In the past, switching between modes required the use of complex logic within each method or the implementation of different objects for each state or multiple instance variables. These solutions have resulted in complex code logic, which results in a degradation in performance during the design of programs using a visual program builder and results in programs which are difficult to understand and maintain.